package com.rimi.controller;

import com.rimi.bean.BroadcastImage;
import com.rimi.bean.Menu;
import com.rimi.bean.Video;
import com.rimi.service.BroadcastImageService;
import com.rimi.service.MenuService;
import com.rimi.service.MenuTypeService;
import com.rimi.service.VideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Controller
@RequestMapping("/index")
public class IndexPageController {
    @Autowired
    private MenuService menuService;
    @Autowired
    private VideoService videoService;
    @Autowired
    private BroadcastImageService broadcastImageService;


    @RequestMapping("index")
    public String toIndex(Model model){



        List<Menu> menuList = menuService.getMenuList();
        model.addAttribute("menus", menuList);

        List<Video> videoList = videoService.getVideoList();
        model.addAttribute("Video", videoList);

        List<BroadcastImage> broadcastImage = broadcastImageService.getBroadcastImage();
        model.addAttribute("broadcastImage", broadcastImage);






        return "index";
    }

}
